﻿using System;
using System.Collections.Generic;
using System.Text;
using Wolfut.MirageEE.Domain.CommonUtilities;
using Wolfut.MirageEE.UI.UIBaseComponents;

namespace Wolfut.MirageEE.UI.UICommonUtilities
{
    /// <summary>
    /// ExceptionRender 的摘要说明。
    /// </summary>
    public class ExceptionRender
    {
        private Constant.RenderType MyRenderType;

        public ExceptionRender()
        {
            //
            // TODO: 在此处添加构造函数逻辑
            //
        }

        public ExceptionRender(Constant.RenderType objRender)
        {
            MyRenderType = objRender;
        }
        public void WriteToClient(string message)
        {
            if (this.MyRenderType == Constant.RenderType.WEB)
            {
                //Page page = (Page)System.Web.HttpContext.Current.Handler;

                //if (page.FindControl(MyConstant.Message.MessageControlID) != null)
                //{
                //    Control msgControl = page.FindControl(MyConstant.Message.MessageControlID);
                //    PropertyInfo propertyInfo = msgControl.GetType().GetProperty(MyConstant.Message.MessageControlText);

                //    propertyInfo.SetValue(msgControl, message, null);
                //}

            }
            else
            {

                ExceptionForm myForm = new ExceptionForm();
                myForm.DisplayMessage(message);
                myForm.ShowDialog();

            }
        }
    }
}
